// import axios from 'axios'

const ConfigBaseURL = '/api/'
// const ConfigBaseURL = 'xxx'
export const request = function(data) {
	return new Promise((resolve, reject) => {
		uni.request({
			method: data.method.toUpperCase() || 'GET',
			url: ConfigBaseURL + data.url,
			data,
			header: {token:uni.getStorageSync('token')},
			success: (res) => {
				resolve(res.data)
			},
			fail: (err) => {
				reject(err)
			},
			complete: () => {
				uni.hideLoading()
			}
		})
	})
}
